<?php
# http://projects:8081/cdapp-2kt-api/api/seat_set_color.php
include_once '_portal.php';

if (!isset($_GET['seat']) || $_GET['seat'] == '' || !isset($_GET['color']) || $_GET['color'] == '' || !isset($_GET['dark']) || $_GET['dark'] == '') {
  die;
}
$seat = $_GET['seat'];
$color = $_GET['color'];
$dark = $_GET['dark'];
$sql = '';
if ($dark == 0) {
  $sql = "UPDATE `2kt_seat_status` SET `color`='#{$color}' WHERE `seatName`='{$seat}'";
} else {
  $sql = "UPDATE `2kt_seat_status` SET `defaultColor`='#{$color}' WHERE `seatName`='{$seat}'";
}
$result = exec_sql($sql);
output(['api' => 'seat_set_color', 'result' => $result]);